package com.ehome.poct.base.controller.mapping;

import cn.hutool.json.JSONUtil;
import com.ehome.poct.base.api.dto.device.bootModule.TestDeviceBootInfoDTO;
import com.ehome.poct.base.api.vo.device.BootDetailExportVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import java.time.LocalDateTime;

@Mapper(componentModel = "spring", imports = {JSONUtil.class})
public interface BootingInfoMapping {
    @Mappings({
        @Mapping(source = "sno",target = "sno"),
        @Mapping(source = "createTime",target = "createTime"),
        @Mapping(source = "bootInfo.communication.common.failureRate",target = "commonFailureRate"),
        @Mapping(source = "bootInfo.communication.log.failureRate",target = "logFailureRate"),
        @Mapping(source = "bootInfo.communication.motor.failureRate",target = "motorFailureRate"),
        @Mapping(source = "bootInfo.communication.hgb.average",target = "hgbAverage"),
        @Mapping(source = "bootInfo.communication.hgb.median",target = "hgbMedian"),
        @Mapping(source = "bootInfo.communication.hgb.variance",target = "hgbVariance"),
        @Mapping(source = "bootInfo.scanner.pass",target = "scannerPass"),
        @Mapping(source = "bootInfo.motion.XMotor.accuracy",target = "XAccuracy"),
        @Mapping(source = "bootInfo.motion.XMotor.deviation",target = "XDeviation"),
        @Mapping(source = "bootInfo.motion.XMotor.code",target = "XCode"),
        @Mapping(source = "bootInfo.motion.YMotor.accuracy",target = "YAccuracy"),
        @Mapping(source = "bootInfo.motion.YMotor.deviation",target = "YDeviation"),
        @Mapping(source = "bootInfo.motion.YMotor.code",target = "YCode"),
        @Mapping(source = "bootInfo.motion.ZMotor.accuracy",target = "ZAccuracy"),
        @Mapping(source = "bootInfo.motion.ZMotor.deviation",target = "ZDeviation"),
        @Mapping(source = "bootInfo.motion.ZMotor.code",target = "ZCode"),
        @Mapping(source = "bootInfo.check.light",target = "light"),
        @Mapping(source = "bootInfo.check.camera.connect",target = "cameraConnect"),
        @Mapping(source = "bootInfo.check.camera.luminance",target = "centerLight"),
        @Mapping(source = "bootInfo.check.camera.ri",target = "ri"),
        @Mapping(source = "bootInfo.check.camera.darkLuminance",target = "darkLuminance"),
        @Mapping(source = "bootInfo.check.camera.darkRi",target = "darkRi"),
        @Mapping(source = "bootInfo.check.camera.frameRate",target = "frameRate"),
        @Mapping(source = "bootInfo.check.camera.passRate",target = "passRate"),
        @Mapping(source = "bootInfo.storage.pass",target = "storagePass"),
        @Mapping(source = "bootInfo.network.downloadSpeed",target = "downloadSpeed"),
        @Mapping(source = "bootInfo.network.latency",target = "latency"),
        @Mapping(source = "bootInfo.network.lossRate",target = "lossRate"),
        @Mapping(source = "bootInfo.network.uploadSpeed",target = "uploadSpeed"),
        @Mapping(source = "bootInfo.network.rssi",target = "rssi"),
    })
    BootDetailExportVO toExport(String sno, LocalDateTime createTime,TestDeviceBootInfoDTO bootInfo);

}
